<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<ui:composition template="/templates/component-sample.xhtml">
		<ui:define name="sample">
			
			<p>a4j:loadScript is similar to the standard script tag with src attribute, but it allows
			to load script from alternative sources like a jar file.
			</p>
			<p>
			<b>src</b> attribute defines the context relative path to the script. Instead of html
			 script tag it's not required to have a prefix of your application. The leading slash in 
			 the path means the root of the web context.
			</p>
			<p>
				You can use "resource://" prefix to access the script file using
				RichFaces resource framework. For example, if your script file is located inside the
				jar file and has a full path there: /org/mycompany/assets/script/focus.js , you can
				point to it with:
				<pre style="margin:0px">
	<span class="xml_tag_symbols">&lt;</span><span class="xml_tag_name">a4j:loadScript</span><span class="xml_plain"> </span><span class="xml_attribute_name">src</span><span class="xml_tag_symbols">=</span><span class="xml_attribute_value">"resource:///org/mycompany/assets/script/focus.js"</span><span class="xml_plain"> </span><span class="xml_tag_symbols">/&gt;</span><span class="xml_plain"/>
				</pre>
			</p>
			<p>
				It is possible to register aliases in the static script files or dynamically
				generated scripts and use those aliases then. For example, RichFaces has an
				alias for the prototype.js script. So, you can point to "resource://prototype.js" as
				a src for loading script and use prototype features. The following example
				shows how to use shipped with RichFaces prototype.js and script.aculo.us to create
				a client-side effects.
			</p>


			<div id="itme" class="sample-container">

				<ui:include src="/richfaces/script/examples/manually.xhtml"/>
				<ui:include src="/templates/include/sourceview.xhtml">
					<ui:param name="sourcepath" value="/richfaces/script/examples/manually.xhtml"/>
				</ui:include>
										
			</div>
				
		
			<p>
				Note that if you have an Ajax functionality on a page, the prototype.js is already 
				attached to this page and you do not have to include it explicitly once again.
			</p>
			<p>
				Since version 3.1.0, RichFaces introduced the rich:effect component. Hence, you do not have
				to write any javascript to make effects appear in your application.
			</p>
		</ui:define>
	</ui:composition>
</html>
